<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Prototype Chain</title>
<!-- <script type="text/javascript">
	var Person = function() {};
	var p = new Person();
	alert(p.__proto__ === Person.prototype);
</script> -->
<script type="text/javascript">
	var Person = function() {};
	Person.prototype.say = function() {
		alert("Person says something.");
	};
	Person.prototype.salary = 50000;
	
	var Programmer = function() {};
	Programmer.prototype = new Person();
	Programmer.prototype.writeCode = function() {
		alert("Programmer writes code.")
	};
	Programmer.prototype.salary = 500;
	var p = new Programmer();
	p.say();
	p.writeCode();
	alert(p.salary);
</script>
</head>
<body>

</body>
</html>